# 动物类：名字， eat(), run();
# 子类：猫类，狗类

# 父类，基类，超类，superclass
class Animal:

    def __init__(self, name):
        self.name = name

    def eat(self):
        print('animal eat....')

    def run(self):
        print('animal run...')


# 子类，扩展类，派生类，subclass
class Cat(Animal):
    def __init__(self, name, color):
        # self.name = name
        # super() --> 父类
        super().__init__(name)
        self.color = color

    def catch_mouse(self):
        print('猫抓老鼠....')

    def run(self):  # 重写  复写 overwrite  子类的方法名称 和参数 和父类一样
        print('animal run...', 'miao maiao miao.........')


cat1 = Cat('kitty', 'black')
cat1.run()

print(cat1.name)
print(cat1.color)

# cat1.eat()
# cat1.run()
anim = Animal('aa')
# print(anim.color)  # 父类不会具有子类的属性

print(type(anim))
print(type(cat1))
print(type(8))

print(isinstance(cat1, Cat))
print(isinstance(cat1, Animal))

print(issubclass(Cat, Animal))
